package o8deleteassignnumber;

/**
 * @author shkstart
 * @create 2022-01-01-19:55
 */
public class DeleteAssignNumber {

    public static void main(String[] args) {

        int[] nums = {1,1,1,2,3,4,5};

        int number = removeElement(nums, 1);

        for (int i = 0; i < number; i++) {
            System.out.println(nums[i]);
        }
    }

    public static int removeElement(int[] nums, int val) {
        int sign = 0;

        for (int i = 0; i < nums.length; i++) {
            if (nums[i] != val) {
                nums[sign++] = nums[i];
            }
        }
        return sign;
    }
}
